<?php
$front_template = Zend_Registry::get('front_template');
echo $this->headLink()->setStylesheet($this->baseUrl().'/js/jquery/pirobox/css_pirobox/demo5/style.css'); 
echo $this->headScript()->setFile($this->baseUrl().'/js/jquery/pirobox/pirobox.js');
echo $this->headScript()->setFile($this->baseUrl().'/js/jquery/qtip/jquery.qtip-min.js');

$global_conf = Zend_Registry::get('global_conf');
$currency = new Zend_Currency($global_conf['default_locale']);

if(!empty($this->view_datas['meta_keywords'])){ $this->headMeta()->setName('keywords',$this->view_datas['meta_keywords']); }
if(!empty($this->view_datas['meta_desc'])) { $this->headMeta()->setName('description',$this->view_datas['meta_desc']); }
if(!empty($this->view_datas['product_name'])) { $this->headTitle()->headTitle($this->escape($this->view_datas['product_name']),'SET')->setSeparator(' - ')->headTitle($this->view_datas['meta_title']); }
?>

<script type="text/javascript">	
	$(function() {
		$('#pro_list').hide();
		$('a.toggle_pro').click(function() {
			var self = this;
			$('#pro_list').slideToggle(500,function () {
				var src = $(self).children("img").attr('src');
				var input = (src == 'application/layouts/scripts/<?php echo $front_template['theme_folder']; ?>/images/mod_img/minus.png') ? 'application/layouts/scripts/<?php echo $front_template['theme_folder']; ?>/images/mod_img/plus.png' : 'application/layouts/scripts/<?php echo $front_template['theme_folder']; ?>/images/mod_img/minus.png';
				$(self).children("img").attr('src',input);
			});
			return false;
		  });
	});
</script>

<div class="gallery-heading">
	<h1><?php echo $this->view_datas['product_name'] ?></h1>
</div>

<div class="clear">&nbsp;</div>

<div class="gallery">
	<!-- Category Panel Start -->
	<?php
	if($this->group_datas['category_panel'] == '1')
	{
			$categoryPanel = new Gallery_View_Helper_CategoryPanel();
			
	?>
    <div class="category">
	<a href="javascript:void(0);" class="toggle_pro toggle-link"><img src="application/layouts/scripts/<?php echo $front_template['theme_folder']; ?>/images/mod_img/plus.png" border="0" /><div class="toggle">BROWSE PHOTOS BY CATEGORY</div></a>
	<div id="pro_list" class="clear">
            
            <div class="mod-cat-list">
            <ul class="cat-list">
                <li><a href="#">Buildings & Structures <span class="count">(3)</span></a></li>
                <li><a href="#">Celebrities <span class="count">(100)</span></a></li>
                <li><a href="#">Flower <span class="count">(4)</span></a></li>
                <li><a href="#">Chemicals <span class="count">(0)</span></a></li>
                <li><a href="#">Science <span class="count">(50)</span></a></li>
            </ul>
            </div>
            
            <div class="mod-cat-list">
            <ul class="cat-list">
                <li><a href="#">Buildings & Structures <span class="count">(3)</span></a></li>
                <li><a href="#">Celebrities <span class="count">(100)</span></a></li>
                <li><a href="#">Flower <span class="count">(4)</span></a></li>
                <li><a href="#">Chemicals <span class="count">(0)</span></a></li>
                <li><a href="#">Science <span class="count">(50)</span></a></li>
            </ul>
            </div>
            
            <div class="mod-cat-list">
            <ul class="cat-list">
                <li><a href="#">Buildings & Structures <span class="count">(3)</span></a></li>
                <li><a href="#">Celebrities <span class="count">(100)</span></a></li>
                <li><a href="#">Flower <span class="count">(4)</span></a></li>
                <li><a href="#">Chemicals <span class="count">(0)</span></a></li>
                <li><a href="#">Science <span class="count">(50)</span></a></li>
            </ul>
            </div>
            
            <div class="mod-cat-list">
            <ul class="cat-list">
                <li><a href="#">Buildings & Structures <span class="count">(3)</span></a></li>
                <li><a href="#">Celebrities <span class="count">(100)</span></a></li>
                <li><a href="#">Flower <span class="count">(4)</span></a></li>
                <li><a href="#">Chemicals <span class="count">(0)</span></a></li>
                <li><a href="#">Science <span class="count">(50)</span></a></li>
            </ul>
            </div>
        </div>
    </div>
    <?php
		}
	?>
	<!-- Category Panel End -->
    
	<div class="topbar">
		<div class="topbar-content">
        	<div class="browse-link">
           	<a href="#">Home</a> » <a href="#">Galleries</a> » <a href="#">Fashion</a> » <a href="#">Images</a> » <a href="#">Women's Fashion</a> » <a href="#">Dress Sample</a></div>
      	</div>
	</div>
    
    <div class="clear">&nbsp;</div>
    
    <div class="gallery-container gallery-details">
        Image Details
    </div>
    
    <div class="clear">&nbsp;</div>
    
    
    <div class="gallery-container related">
        <div class="related-title">Related Pictures in this Gallery</div>
        	<div class="image-box">
           	  <div class="thumb related-thumb"><img src="images/powered_logo.gif" width="80" border="0" class="thumb-img" title=""></div>
            </div>
			<div class="image-box active">
            	<div class="thumb related-thumb"><img src="images/powered_logo.gif" width="80" border="0" class="thumb-img" title=""></div>
            </div>
            <div class="image-box">
            	<div class="thumb related-thumb"><img src="images/powered_logo.gif" width="80" border="0" class="thumb-img" title=""></div>
            </div>
            <div class="image-box">
            	<div class="thumb related-thumb"><img src="images/powered_logo.gif" width="80" border="0" class="thumb-img" title=""></div>
            </div>
            <div class="image-box">
            	<div class="thumb related-thumb"><img src="images/powered_logo.gif" width="80" border="0" class="thumb-img" title=""></div>
            </div>
    </div>
    
    <!-- Getting All Comments from Comment Module and Add Comment Form -->
    <?php 
        $allCommentObj = new Comment_View_Helper_RepliedComment($this);
        echo $allCommentObj->getAllActiveComments('gallery_product',$this->escape($this->view_datas['id']));		
    ?>
    <!-- End of Getting All Comments from Comment Module Add Comment Form -->
    
</div>



<table width="100%">
	<tr>
		<td valign="top">
			<?php
				if($this->group_datas['gallery_type'] == 'video' || $this->group_datas['gallery_type'] == 'music')
				{
					//echo $this->headScript()->appendFile($this->baseUrl().'/js/jquery/media/jquery.metadata.js');
					echo $this->headScript()->setFile($this->baseUrl().'/js/jquery/media/jquery.media.js');
					$product_file_val_arr = explode(',',$this->view_datas['product_file']);	
									
				?>
					<script type="text/javascript">
						$(document).ready(function() {
							$('.media_gallery').media({
								width:		'<?php echo $this->escape($this->group_datas["img_big_width"]);?>',
								height:		'<?php echo $this->escape($this->group_datas["img_big_height"]);?>',
								flvPlayer:     'js/jquery/media/mediaplayer.swf', 
								mp3Player:     'js/jquery/media/mediaplayer.swf'
							});
						});
					</script>
					<table width="100%">
						<tr>
							<?php
							if(!empty($this->view_datas['product_file']))
							{
								$cnt = 1;
								foreach($product_file_val_arr as $key=>$value)
								{
										$file_ext = Eicra_File_Utility::getExtension($this->escape($value));		
										$light_box_image = $this->baseUrl().'/data/frontImages/gallery/video_file/'.$this->escape($value); 
										switch($file_ext)
										{
											case 'swf':
											case 'flv':
											case 'mp3':
												$href = 'js/jquery/media/mediaplayer.swf?file='.$light_box_image;
												break;
											case 'wmv':
											case 'avi':
											case 'mpg':
											case '3g2':
											case 'ram':										
												$href = $light_box_image;
												break;
											default:
												$href = $light_box_image;
												break;
										}
								?>
								<td align="center" >
									<a class="media_gallery" href="<?php echo $href; ?>"><?php echo $this->escape($value); ?></a>
								</td>
								<?php
									if($cnt % $this->escape($this->group_datas["file_col_num"]) == 0)
									{
										echo '</tr><tr>';
									}
									$cnt++;
								}
							 }
							 else
							 {
							?>
								<td align="center">
									<?php echo stripslashes($this->view_datas['product_desc']); ?>
								</td>
							<?php
							 }
							?>
						</tr>
					</table>
				<?php
				}
				else
				{
				?>
				<script type="text/javascript">
					$(document).ready(function() {
						$('.pirobox').piroBox({
								my_speed: 300, //animation speed
								bg_alpha: 0.7, //background opacity
								slideShow : false, // true == slideshow on, false == slideshow off
								slideSpeed : 4, //slideshow duration in seconds(3 to 6 Recommended)
								close_all : '.piro_close,.piro_overlay'// add class .piro_overlay(with comma)if you want overlay click close piroBox
					
						});
						$('a.change_img').click(function() {
							var self = this;
							var rel = $(self).attr('rel');
							$('a.pirobox').attr('href','data/frontImages/gallery/product_image/'+rel);
							$('a.pirobox').children("img:nth-child(1)").attr('src','data/frontImages/gallery/product_image/'+rel);
						});
						$('img[title]').qtip({			
							position: { corner: { target: 	'topMiddle', tooltip: 	'bottomLeft'	} },
							show: { when: { target: false, event: 'mouseover' }, effect: { type: 'grow', length: '1000' } },
							hide: { when: { target: false, event: 'mouseout' }, effect: { type: 'slide', length: '1000' } },
							style: { name: 'green', color: '#005100', tip: true } 
						});
					});
					</script>
				<table width="100%"  border="0" cellpadding="0" cellspacing="0">
					<tr>
						<td align="center">
						<?php
							if($this->escape($this->view_datas['product_thumb_primary']))
							{ 
								$thumb_image = 'data/frontImages/gallery/product_thumb/'.$this->escape($this->view_datas['product_thumb_primary']); 
							}
							else
							{ 
								if($this->escape($this->view_datas['product_thumb']))
								{
									$product_thumb_val_arr = explode(',',$this->view_datas['product_thumb']);
									$thumb_image = 'data/frontImages/gallery/product_thumb/'.$this->escape($product_thumb_val_arr[0]); 
								}
								else
								{
									if($this->escape($this->view_datas['product_file_primary']))
									{
										$thumb_image = 'data/frontImages/gallery/product_image/'.$this->escape($this->view_datas['product_file_primary']); 
									}
									else
									{
										$product_file_val_arr = explode(',',$this->view_datas['product_file']);
										$thumb_image = 'data/frontImages/gallery/product_image/'.$this->escape($product_file_val_arr[0]); 
									}
								}		
							}
							 
							if($this->escape($this->view_datas['product_file_primary']))
							{
								$light_box_image = 'data/frontImages/gallery/product_image/'.$this->escape($this->view_datas['product_file_primary']); 
							}
							else
							{
								$product_file_val_arr = explode(',',$this->view_datas['product_file']);
								$light_box_image = 'data/frontImages/gallery/product_image/'.$this->escape($product_file_val_arr[0]); 
							}
							
							 $title_data = '<b>'.$this->translator->translator('gallery_common_name').'</b> '.$this->escape($this->view_datas['product_name']); 
							 if($this->escape($this->view_datas['product_code']))
							 { 
								$title_data .= '<br /><b>'.$this->translator->translator('gallery_common_code').' </b>'.$this->escape($this->view_datas['product_code']); 
							 } 
							 if($this->escape($this->view_datas['product_price']))
							 { 
								$title_data .= '<br /><b>'.$this->translator->translator('gallery_common_price').'</b> '.$this->escape($this->view_datas['product_price']).'&nbsp;'.$currency->getSymbol(); 
							 }
							 if($this->escape($this->view_datas['product_desc']))
							 {  
								$title_data .= '<br /><b>'.$this->translator->translator('gallery_common_desc').' </b>'.$this->escape(strip_tags($this->view_datas['product_desc']));
							 }
						?>
						<?php 						
							if($this->group_datas['img_big_resize_func'] != 'OriginalSize')
							{
								if($this->group_datas['img_big_width'] && ($this->group_datas['img_big_resize_func'] == 'resizeToWidth' || $this->group_datas['img_big_resize_func'] == 'resize'))
								{ 
									$width = 'width="'.$this->escape($this->group_datas['img_big_width']).'"'; 
								} 
								if($this->group_datas['img_big_height'] && ($this->group_datas['img_big_resize_func'] == 'resizeToHeight' || $this->group_datas['img_big_resize_func'] == 'resize'))
								{ 
									$height = 'height="'.$this->escape($this->group_datas['img_big_height']).'"';
								} 
							}
						?>
						<a class="pirobox" href="<?php echo $light_box_image; ?>" title="<?php echo $this->escape($this->view_datas['product_name']); ?>"><img title="<?php echo $title_data; ?>" style="padding:5px;border:1px solid #CCCCCC;background-color:#FCFCFC;" src="<?php echo $light_box_image; ?>" <?php echo $width." ".$height; ?> /></a>
						
						</td>
					</tr>
					<tr>
					  <td>&nbsp;</td>
					</tr>
					<tr>
					  <td height="4" bgcolor="#7EAD21"></td>
					</tr>
					<tr>
					  <td>&nbsp;</td>
					</tr>
					<tr>
						<td valign="top">
							<?php
								$product_file_arr = explode(',',$this->view_datas['product_file']);
								foreach($product_file_arr as $key=>$value)
								{
							?>
								<a href="javascript:void(0);" style="text-decoration:none;" class="change_img" rel="<?php echo $value; ?>" title="<?php echo $this->escape($this->view_datas['product_name']); ?>" ><img style="padding:5px;border:1px solid #CCCCCC;background-color:#FCFCFC;" src="<?php echo 'data/frontImages/gallery/product_image/'.$value; ?>" <?php if($this->group_datas['file_thumb_width'] && $this->group_datas['file_thumb_resize_func'] != 'resizeToHeight'){ echo 'width="'.$this->escape($this->group_datas['file_thumb_width']).'"'; } if($this->group_datas['file_thumb_height'] && $this->group_datas['file_thumb_resize_func'] != 'resizeToWidth'){ echo 'height="'.$this->escape($this->group_datas['file_thumb_height']).'"'; } ?> /> </a>&nbsp;
							<?php
								}
							?>
						</td>
					</tr>				
				</table>
			<?php
				}
			?>
		</td>
		<?php
		if($this->group_datas['category_panel'] == '1')
		{
				$categoryPanel = new Gallery_View_Helper_CategoryPanel();
				
		?>
		<td width="18%" valign="top" bgcolor="#EDECE4">
			 <div class="category_header" style="padding-top:10px;">&nbsp;<u><a href="<?php echo $this->url(array('module' => 'Gallery','controller' =>'frontend', 'action' => 'view',menu_id => $this->menu_id ),$this->escape($this->menu_id)); ?>"><?php echo 'Gallery Category'; ?></a></u></div>
			 <div>&nbsp;</div>
			  <div style="width:140px; overflow:auto;" class="news_category_1">
				<?php echo $categoryPanel->getSubCategory('0',$this,$this->group_datas['id'],null,$this->menu_id); ?>
			</div>
		</td>
		<?php
		}
		?>
	</tr>
	<tr>
		<td width="300px">
			<?php 
			$allCommentObj = new Comment_View_Helper_RepliedComment($this);
			echo $allCommentObj->getAllActiveComments('gallery_product',$this->escape($this->view_datas['id']));
		?>
		</td>
	</tr>
</table>
